﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="html" indent="yes"/>
  <xsl:variable name="Header">
    <tr class="RowHeader">
      <td>
        名称
      </td>
      <td>
        值
      </td>
    </tr>
  </xsl:variable>

  <xsl:template match="/Procedure">
    <html>
      <head>
        <link rel="StyleSheet" href="default.css" type="text/css" />
        <script type="text/javascript" language="javascript">
              function copy(o)
              {
                  var text=document.getElementById(o).innerText;
                  window.clipboardData.setData("text",text);
              }

        </script>
      </head>
      <body>
        <h3>
          <xsl:value-of select="@Type"/> | <xsl:value-of select="@Schema"/>.<xsl:value-of select="@Name"/>
        </h3>
        <hr></hr>
        <h4>第一部分：属性</h4>
        <table>
          <xsl:copy-of select="$Header"/>
          <xsl:for-each select="Properties/Property">
            <tr>
              <td>
                <xsl:value-of select="Name"/>
              </td>
              <td>
                <xsl:value-of select="Value"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>


        <h4>第二部分：扩展属性</h4>
        <table>
          <xsl:copy-of select="$Header"/>
          <xsl:for-each select="ExtendedProperties/ExtendedProperty">
            <tr>
              <td>
                <xsl:value-of select="Name"/>
              </td>
              <td>
                <xsl:value-of select="Value"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>




        <h4>第三部分：被依赖</h4>
        <table>
          <tr class="RowHeader">
            <td>类别</td>
            <td>架构</td>
            <td>名称</td>

          </tr>

          <xsl:for-each select="ChildDependencies/ChildDependency">
            <tr>
              <td>
                <xsl:value-of select="Type"/>
              </td>
              <td>
                <xsl:value-of select="Schema"/>
              </td>
              <td>
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="Schema"/>.<xsl:value-of select="Name"/>.xml
                  </xsl:attribute>
                  <xsl:value-of select="Name"/>
                </a>
              </td>

            </tr>

          </xsl:for-each>

        </table>

        <h4>第四部分：依赖</h4>
        <table>
          <tr class="RowHeader">
            <td>类别</td>
            <td>架构</td>
            <td>名称</td>

          </tr>

          <xsl:for-each select="ParentDependencies/ParentDependency">
            <tr>
              <td>
                <xsl:value-of select="Type"/>
              </td>
              <td>
                <xsl:value-of select="Schema"/>
              </td>
              <td>
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="Schema"/>.<xsl:value-of select="Name"/>.xml
                  </xsl:attribute>
                  <xsl:value-of select="Name"/>
                </a>
              </td>

            </tr>

          </xsl:for-each>

        </table>


        <h4>第五部分：脚本</h4>
        <a href="javascript:copy('script');">复制</a>
        <hr></hr>
        <span id="script">
          <xsl:value-of select="Script" disable-output-escaping="yes"/>

        </span>
      </body>
    </html>

  </xsl:template>
</xsl:stylesheet>
